
import React from 'react';

type FileType = 'md' | 'txt' | 'html' | 'csv' | 'dir';

interface FileIconProps {
    className?: string;
    type: FileType;
}

const FileIcon: React.FC<FileIconProps> = ({ className = '', type }) => {
    const icons = {
        md: (
            <svg t="1750996380342" className={className} viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13662" width="200" height="200">
                <path d="M722.261333 0H191.786667A161.578667 161.578667 0 0 0 30.208 161.578667V862.293333a161.578667 161.578667 0 0 0 161.578667 161.578667h640.426666a161.578667 161.578667 0 0 0 161.578667-161.578667V271.530667a137.173333 137.173333 0 0 0-40.192-97.024L819.242667 40.149333A137.216 137.216 0 0 0 722.261333 0z" fill="#53B7F4" p-id="13663"></path>
                <path d="M953.642667 174.506667L819.285333 40.149333a137.216 137.216 0 0 0-70.613333-37.632v150.784a86.656 86.656 0 0 0 86.698667 86.698667h154.794666a137.173333 137.173333 0 0 0-36.522666-65.493333z" fill="#29A3D3" p-id="13664"></path>
                <path d="M667.093333 717.269333a27.434667 27.434667 0 0 1-27.434666-27.434666v-258.688l-107.861334 106.666666a27.434667 27.434667 0 0 1-38.4 0l-108.928-107.008v259.754667a27.434667 27.434667 0 0 1-54.869333 0V365.397333a27.434667 27.434667 0 0 1 46.677333-19.584l136.32 133.930667 135.381334-133.845333a27.434667 27.434667 0 0 1 46.933333 19.498666v324.266667a27.434667 27.434667 0 0 1-27.818667 27.605333z" fill="#29A3D3" p-id="13665"></path>
                <path d="M667.136 324.266667a27.434667 27.434667 0 0 0-19.285333 7.936l-135.381334 133.845333-136.32-133.888a27.434667 27.434667 0 0 0-46.677333 19.584v325.162667a27.434667 27.434667 0 0 0 54.869333 0V417.152l108.928 107.008a27.434667 27.434667 0 0 0 38.4 0l107.861334-106.666667v258.688a27.434667 27.434667 0 1 0 54.869333 0v-324.266666a27.434667 27.434667 0 0 0-27.434667-27.434667z" fill="#FFFFFF" p-id="13666"></path>
            </svg>
        ),
        txt: (
            <svg t="1752503045187" className={className} viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4517" width="200" height="200"><path d="M204.8 0h477.866667l273.066666 273.066667v614.4c0 75.093333-61.44 136.533333-136.533333 136.533333H204.8c-75.093333 0-136.533333-61.44-136.533333-136.533333V136.533333C68.266667 61.44 129.706667 0 204.8 0z m341.333333 512h136.533334c20.48 0 34.133333-13.653333 34.133333-34.133333s-13.653333-34.133333-34.133333-34.133334H341.333333c-20.48 0-34.133333 13.653333-34.133333 34.133334s13.653333 34.133333 34.133333 34.133333h136.533334V819.2c0 20.48 13.653333 34.133333 34.133333 34.133333s34.133333-13.653333 34.133333-34.133333V512z" fill="#777777" p-id="4518"></path><path d="M682.666667 0l273.066666 273.066667h-204.8c-40.96 0-68.266667-27.306667-68.266666-68.266667V0z" fill="#E0E0E0" opacity=".619" p-id="4519"></path></svg>
        ),
        html: (
            <svg t="1752549781044" className={className} viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24387" width="200" height="200"><path d="M677.504 64a64 64 0 0 1 45.248 18.752l154.496 154.496a64 64 0 0 1 18.752 45.248V832a128 128 0 0 1-128 128H256a128 128 0 0 1-128-128V192a128 128 0 0 1 128-128h421.504zM640 377.6a38.4 38.4 0 0 0-38.4 38.4v121.6H422.4V416a38.4 38.4 0 0 0-76.8 0v320a38.4 38.4 0 1 0 76.8 0V614.4h179.2v121.6a38.4 38.4 0 1 0 76.8 0v-320a38.4 38.4 0 0 0-38.4-38.4z" p-id="24388" fill="#d81e06"></path></svg>
        ),
        csv: (
            <svg t="1752549656391" className={className} viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11216" width="200" height="200"><path d="M134.4 64m153.6 0l448 0q153.6 0 153.6 153.6l0 588.8q0 153.6-153.6 153.6l-448 0q-153.6 0-153.6-153.6l0-588.8q0-153.6 153.6-153.6Z" fill="#3EC757" p-id="11217"></path><path d="M240.0256 513.1776c0-14.9504 2.1504-29.184 6.4512-42.8544 4.352-13.6192 10.752-25.6 19.3536-35.9424 8.4992-10.3424 19.1488-18.6368 31.8976-24.9344s27.4944-9.472 44.3392-9.472c13.3632 0 25.6512 2.4064 36.864 7.1168 11.1104 4.7104 19.6096 9.9328 25.3952 15.7184 2.048 2.048 4.096 4.7104 6.0928 7.8336a35.2768 35.2768 0 0 1 4.3008 10.24 31.232 31.232 0 0 1 0.8192 11.008 18.8928 18.8928 0 0 1-4.5568 10.24 26.3168 26.3168 0 0 1-4.7104 4.3008 21.1456 21.1456 0 0 1-16.5376 3.328 17.92 17.92 0 0 1-9.472-6.5024 66.304 66.304 0 0 0-16.384-14.5408 40.192 40.192 0 0 0-21.0432-5.12 46.336 46.336 0 0 0-21.6576 5.12 49.5616 49.5616 0 0 0-16.7424 14.1824c-4.608 5.9904-8.192 13.312-10.8544 22.016a98.4064 98.4064 0 0 0-3.9424 28.672c0 11.008 1.536 20.6336 4.5568 28.8768 3.0208 8.2432 7.0144 15.2064 11.9808 20.8384 5.0176 5.632 10.6496 9.8816 16.9472 12.8a45.9776 45.9776 0 0 0 19.3024 4.3008c5.0176 0 9.1648-0.3072 12.4416-0.8192a28.2112 28.2112 0 0 0 13.568-5.6832 537.5488 537.5488 0 0 1 12.2368-9.4208 27.8528 27.8528 0 0 1 8.2432-4.352 20.5824 20.5824 0 0 1 9.472-0.5632c3.4304 0.512 7.1168 2.048 11.0592 4.7104 5.7344 3.9424 9.216 8.0384 10.24 12.3904 1.024 4.3008-0.4096 9.8816-4.352 16.6912-5.2736 9.1648-14.0288 16.5376-26.4192 22.1696-12.288 5.632-27.5456 8.4992-45.6704 8.4992a116.224 116.224 0 0 1-44.1344-7.8848 88.0128 88.0128 0 0 1-32.512-22.4256 95.5392 95.5392 0 0 1-19.9168-34.9696 145.8176 145.8176 0 0 1-6.656-45.568zM512.4096 576.4096c8.6016 0 15.872-1.9968 21.76-5.888a18.7392 18.7392 0 0 0 8.8064-16.5376 19.5072 19.5072 0 0 0-1.7408-8.448 18.6368 18.6368 0 0 0-6.656-7.0656 69.7344 69.7344 0 0 0-13.3632-6.656 262.144 262.144 0 0 0-21.76-7.2704 232.0896 232.0896 0 0 1-28.2624-9.8304 68.4544 68.4544 0 0 1-19.4048-12.1856 43.8784 43.8784 0 0 1-11.3664-16.896 66.56 66.56 0 0 1-3.7376-23.552c0-9.728 1.9968-18.432 5.888-26.112 3.9424-7.7312 9.3696-14.336 16.2816-19.6608 6.912-5.376 14.9504-9.4208 24.1152-12.1856 9.1648-2.7648 18.8416-4.096 29.0304-4.096 10.752 0 20.5824 1.1776 29.5936 3.5328 9.0112 2.3552 16.7424 5.3248 23.1424 9.0112s11.4688 7.5776 15.104 11.776c3.6864 4.1984 5.4784 7.9872 5.4784 11.4176 0 7.8336-1.28 15.104-3.8912 21.8112-2.6112 6.656-6.8096 9.984-12.544 9.984a8.8576 8.8576 0 0 1-5.5296-2.1504 303.2064 303.2064 0 0 1-7.8336-6.5024 98.048 98.048 0 0 0-18.0224-11.3664 62.8736 62.8736 0 0 0-25.088-4.7104 37.0176 37.0176 0 0 0-18.6368 3.9424c-5.632 2.8672-8.448 7.68-8.448 14.4896 0 3.1744 0.6656 5.7856 1.9456 7.8848 1.3312 2.048 3.6864 3.9936 7.0656 5.6832 3.4304 1.6896 7.7824 3.4816 13.1584 5.3248 5.376 1.8432 12.2368 3.9424 20.5824 6.2976 8.9088 2.56 17.2544 5.632 25.088 9.0112 7.8336 3.4304 14.6432 7.5776 20.4288 12.5952 5.7344 4.9664 10.24 11.0592 13.5168 18.2272 3.2768 7.2192 4.9152 15.9232 4.9152 26.112 0 10.496-2.3552 19.968-7.0656 28.3136a67.3792 67.3792 0 0 1-18.6368 21.1968 94.6176 94.6176 0 0 1-55.5008 18.0736 107.6736 107.6736 0 0 1-57.2416-15.872 67.2256 67.2256 0 0 1-15.872-13.3632c-3.7888-4.608-5.7344-8.448-5.7344-11.6224 0-3.1232 0.3072-6.4512 0.8192-9.984a38.8096 38.8096 0 0 1 2.7136-9.8304 26.5728 26.5728 0 0 1 4.9152-7.68 9.984 9.984 0 0 1 7.68-3.1232c2.56 0 5.3248 1.4336 8.192 4.3008 2.9184 2.9184 6.656 6.144 11.2128 9.6256 4.5568 3.584 10.4448 6.7584 17.6128 9.6256 7.168 2.9184 16.2816 4.352 27.2896 4.352zM715.6224 601.9584c-3.4304 7.0656-6.8608 11.776-10.4448 14.336a18.6368 18.6368 0 0 1-10.752 3.6864 23.296 23.296 0 0 1-10.8544-2.7136c-3.584-1.8432-7.2704-6.9632-11.264-15.36l-66.048-164.9152a26.5728 26.5728 0 0 1-2.1504-12.8 23.1424 23.1424 0 0 1 3.584-10.5472 20.1728 20.1728 0 0 1 8.0384-7.1168 26.112 26.112 0 0 1 11.776-2.56c4.4544 0 8.9088 1.2288 13.3632 3.584 4.4544 2.3552 7.8848 6.656 10.24 12.9536l44.032 119.808c7.3728-20.48 14.6944-40.448 22.016-59.904 7.3728-19.5072 14.7456-39.4752 22.0672-59.904a31.0784 31.0784 0 0 1 7.8848-11.776 16.896 16.896 0 0 1 11.776-4.7104c3.4304 0 6.912 0.7168 10.4448 2.1504 3.5328 1.4336 6.656 3.4816 9.216 6.0928a18.688 18.688 0 0 1 5.12 9.7792 22.8352 22.8352 0 0 1-1.9456 13.3632l-66.0992 166.5536z" fill="#FFFFFF" p-id="11218"></path></svg>
        ),
        doc: (
            <svg t="1753084925585" className={className} viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7814" width="200" height="200"><path d="M910.2336 1024H113.7664C51.2 1024 0 972.8 0 910.2336V113.7664C0 51.2 51.2 0 113.7664 0h796.4672C972.8 0 1024 51.2 1024 113.7664v796.4672C1024 972.8 972.8 1024 910.2336 1024zM850.5088 253.824h-71.68l-101.3248 391.68c-5.3504 19.328-8.576 36.224-9.6768 50.688h-1.3312c-2.2272-20.0192-5.0944-36.4544-8.6528-49.3824L551.168 253.8496h-65.664L373.8368 643.84c-6.2464 21.9904-9.8816 39.6544-11.008 52.992h-1.9968a254.976 254.976 0 0 0-8.3456-52.992L247.168 253.824H173.4912l149.6832 516.352h77.0048l104.96-372.6592a249.0112 249.0112 0 0 0 9.344-52.6848h1.3312c0.9216 18.6624 3.6864 36.4288 8.3456 53.3248l104.0128 371.9936h77.6704l144.64-516.3264z" fill="#3A80FC" p-id="7815"></path></svg>
        ),
        dir: (
            <svg t="1753254956028" className={className} viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6260" width="200" height="200"><path d="M529.664 213.333333H896a42.666667 42.666667 0 0 1 42.666667 42.666667v597.333333a42.666667 42.666667 0 0 1-42.666667 42.666667H128a42.666667 42.666667 0 0 1-42.666667-42.666667V170.666667a42.666667 42.666667 0 0 1 42.666667-42.666667h316.330667l85.333333 85.333333z" fill="#bfbfbf" p-id="6261"></path></svg>
        )
    };

    const findIcon = (type: string) => {
        switch (type) {
            case 'md':
                return icons.md;
            case 'txt':
                return icons.txt;
            case 'html':
                return icons.html;
            case 'csv':
            case 'xlsx':
                return icons.csv;
            case 'doc':
            case 'docx':
                return icons.doc;
            case 'dir':
                return icons.dir;
            default:
                return null;
        }
    }

    return findIcon(type);
};

export default FileIcon;
